package com.wc.alorithm_luogu.P5737;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/24 10:45
 * @description https://www.luogu.com.cn/problem/P5737
 * 闰年展示
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main main = new Main();

        int start = sc.nextInt();
        int end = sc.nextInt();

        List<Integer> ans = new ArrayList<>();

        for (int i = start; i <= end; i++) {
            if (main.isRunYear(i)) {
                ans.add(i);
            }
        }
        int size = ans.size();
        if (size == 0) {
            System.out.println(0);
            return;
        }
        System.out.println(size);

        System.out.print(ans.get(0));
        for (int i = 1; i < size; i++) {
            System.out.print(" " + ans.get(i));
        }
    }

    private boolean isRunYear(int num) {
        boolean ans = true;
        if (num % 4 == 0) {
            if (num % 100 == 0) {
                ans = false;
            }
            if (num % 400 == 0) {
                ans = true;
            }
        } else {
            ans = false;
        }

        return ans;
    }
}
